clear all;
close all;
clc

%不同的计算机需要修改此处的地址以调用txt文件
data=load('/Users/tingting/Desktop/p_B.txt');
d=data(:,1);
c=0;
figure;
hold on;
x=-5:0.01:5;
for n=2:2:8
   y=zeros(1,1001);
    for i=0:n
        for j=1:1001
        y(j)=y(j)+d(c+i+1)*x(j)^(n-i);
        end
    end
    l(n)=plot(x,y,'Linewidth',2);
    c=c+n+1;
end
fff=fplot('bb',[-5,5],'Linewidth',2);
legendText = legend([l(2),l(4),l(6),l(8),fff],'n=2','n=4','n=6','n=8','f(x)','FontSize', 18,'FontName','problem_E 2','location','northeast');

